package com.example.demo03_mvm.adapter;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.demo03_mvm.databinding.ItemTypeBinding;
import com.example.demo03_mvm.model.GoodsTypeEntity;

import java.util.List;

public class TypesAdapter extends BaseQuickAdapter<GoodsTypeEntity.DataBean, BaseViewHolder> {
    //List<GoodsTypeEntity.DataBean> list;
    ItemTypeBinding binding;
    /*public TypesAdapter(int layoutResId, List<GoodsTypeEntity.DataBean> list) {
        super(layoutResId);
        this.list = list;
        Log.i("===list",list.toString());
    }*/

    public TypesAdapter(int layoutResId, @Nullable List<GoodsTypeEntity.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        DataBindingUtil.bind(holder.itemView);
        super.onBindViewHolder(holder, position);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, GoodsTypeEntity.DataBean dataBean) {
        Log.i("===",dataBean.toString());
        binding=(ItemTypeBinding) DataBindingUtil.getBinding(baseViewHolder.itemView);
        binding.setTypes(dataBean);
    }
}
